package org.luxor.commons.jdbc.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.luxor.commons.jdbc.annotation.DS;
import org.luxor.commons.jdbc.entity.User;
import org.luxor.commons.jdbc.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Mr.yan @date 2019/10/25
 */
@Service
public class UserService extends ServiceImpl<UserMapper, User> {

    @Resource
    private UserMapper userMapper;

    @DS("${luxor.sys.datasource:slave_1}")
    public List<User> selectList(String phone) {
        return userMapper.selectList(Wrappers.lambdaQuery(User.class).eq(User::getPhone, phone));
    }

}
